Repository navigation
Conversation
The upper bound was DType::U64 (9), but the enum extends to F16 (12), so DType::from panicked for the crate's own S16/U16/F16 types -- which Array::get_type() returns for f16 arrays.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #386.
DType::from(u32)assertedt <= DType::U64 as u32(9), but the enum extends toF16 = 12:So the conversion panicked for three of the crate's own supported types. Since
Array::get_type()callsDType::from, anyf16/s16/u16array panicked onget_type()(and onDebug, which calls it):The fix bounds the assert at
F16instead ofU64.Tests
Added
dtype_from_u32_roundtripincore::defines::tests, asserting every discriminant fromF32throughF16round-trips throughDType::from.Verification
The crate links the native ArrayFire library, which isn't installable on this CI-less machine, so I linked the test binary against a stub
libaf.soexporting the referencedaf_*symbols (this bug is pure Rust logic and never calls into the native library at runtime).cargo test --lib dtype_from_u32_roundtripfails —assertion failed: DType::F32 as u32 <= t && t <= DType::U64 as u32atutil.rs:78(panics att = 10).test core::defines::tests::dtype_from_u32_roundtrip ... ok.